package org.exhaust.framework.net.cmpp20.protocol;

import io.netty.buffer.ByteBuf;
import lombok.Data;
import org.exhaust.framework.net.common.protocol.BaseFrame;
import org.exhaust.framework.net.common.protocol.FrameHeader;
@Data
public class CMPPHeader extends BaseFrame implements FrameHeader {
    private long totalLength;

    private long commandId;

    private long sequenceId;
    @Override
    protected void encodeData(ByteBuf out) {
        out.writeInt((int)totalLength);
        out.writeInt((int)commandId);
        out.writeLong(sequenceId);
    }

    @Override
    public void decode(ByteBuf in, FrameHeader header) {
        this.totalLength = in.readUnsignedInt();
        this.commandId = in.readUnsignedInt();
        this.sequenceId = in.readUnsignedInt();
    }
}
